<ui:composition template="/resources/templates/editable.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:define name="block-header">
        <h:outputText value="#{msgs['block.add.term']}" styleClass="table_name"/>
    </ui:define>

    <ui:define name="editable-content">
        <h:form>
            <table width="100%" border="0">
                <tr>
                    <td colspan="2" class="bottom_dotted"></td>
                </tr>
                <tr>
                    <td colspan="2" class="description">
                        <h:outputText value="#{msgs['rules.term.code']}"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <h:outputLabel value="#{msgs['code']}:" for="code" styleClass="margin1"/>
                    </td>
                    <td>
                        <h:inputText id="code" value="#{termBean.code}" required="true">
                            <f:validateLength minimum="1" maximum="10"/>
                        </h:inputText>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="bottom_dotted"></td>
                </tr>
                <tr>
                    <td colspan="2" class="description">
                        <h:outputText value="#{msgs['rules.term.value']}"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <h:outputLabel value="#{msgs['value']}:" for="value" styleClass="margin1"/>
                    </td>
                    <td>
                        <h:inputText id="value" value="#{termBean.value}" required="true">
                            <f:validateLength minimum="1" maximum="10"/>
                        </h:inputText>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="bottom_dotted"></td>
                </tr>
                <tr>
                    <td colspan="2" class="description">
                        <h:outputText value="#{msgs['rules.term.dictionary']}"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <h:outputLabel value="#{msgs['dictionary']}:" for="dictionary" styleClass="margin1"/>
                    </td>
                    <td>
                        <h:selectOneMenu id="dictionary" value="#{termBean.dictionary}" required="true">
                            <f:selectItem itemLabel="---" itemValue=""/>
                            <f:selectItems value="#{termsController.allDictionaries}" var="dict"
                                           itemLabel="#{dict.code}" itemValue="#{dict.id}"/>
                        </h:selectOneMenu>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="bottom_dotted"></td>
                </tr>
                <tr>
                    <td colspan="2" class="description">
                        <h:outputText value="#{msgs['rules.term.description']}"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <h:outputLabel value="#{msgs['description']}:" for="description" styleClass="margin1"/>
                    </td>
                    <td>
                        <h:inputText id="description" value="#{termBean.description}"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="bottom_dotted"></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <h:commandButton action="#{termsController.addTerm}" title="#{msgs['save']}"
                                         value="#{msgs['save']}"
                                         styleClass="margin2p"/>
                        <h:button outcome="/content/termsPage" title="#{msgs['cancel']}" value="#{msgs['cancel']}"
                                  styleClass="margin2p"/>
                    </td>
                </tr>
            </table>
        </h:form>
    </ui:define>
</ui:composition>